Dynomotion

Group: DynoMotion Message: 12759 From: moray_cuthill Date: 2/6/2016
Subject: KMotionCNC/Machine Initialisation process

I'm mainly looking for confirmation my plan is going to work as intended, so any input to this will be welcome.


I've had my lathe running Mach3 for a couple years, and in that time I've realised the limitations of the existing setup. If my turret fails to lock, then I have to open KMotion and toggle the output to trigger another attempt at locking. The same goes for if for some reason it locks at the wrong position (Every so often it spins the wrong direction, meaning it locks in the wrong position - all that is handled by a PLC, and I've never been able to figure out why, but at most it happens once every couple of hundred changes, and the PLC flags it up as a problem and motion stops so is pretty low on the list of priorities).


As part of my move from Mach3, I'm cleaning up and re-writing code as I go.


My current init flow is something along the lines of-

1) Initialise axis servos. Disable and trigger reset line if needed. If one attempt fails, display message box and ask if another attempt should be made. If not, sit in an infinite loop to stop anything happening. Init has to be run again if needed.

At this point jogging/homing can be allowed, but no code ran.


2) Check status of TC. Make sure position details are being transferred via Modbus, and we have a TCOK signal from the PLC (hardwired to a Kanalog input). If any problems, display a message box, warning the TC has a problem, and advising to move the turret clear of the spindle, and use the Recover TC user button (just a small program to toggle the output allowing a change to happen, but only functions when in initialisation mode (I've got a virtual bit that gets set until everything has initialised ok).

Once the TC is showing good, the lathe can be run as normal.


One area I'm not sure about, is preventing code from being run before the machine is fully initialised. Obviously KMotionCNC doesn't have the same e-stop functionality as Mach, so I'm needing a bit clarification on how to stop things from working.

If I create a user programme that gets run when Cycle Start is pressed, which checks that everything is initialised ok (essentially checks axis are enabled, machine is homed, and TC is good), can I then use that program to issue a Halt motion command if there is a problem?

Or is there a better way to prevent code from running?


The next area is homing. Mach had LEDs showing the homed status of each axis, but I'm guessing I'll need to add checks into the KFlop to ensure homing has been completed prior to any code being executed?


One thing I've noticed when going over my Mach3 init.c file, is I obviously changed the MaxError values instead of the MaxFollowingError values for the axis (it may explain why certain crashes didn't trigger an e-stop!). They're currently 40 for the X and 50 for the Z. Will changing these back to the default of 200 have any undesired consequences, given I don't remember changing that setting when tuning the servos?


Thanks,

Moray

Group: DynoMotion Message: 12761 From: Tom Kerekes Date: 2/6/2016
Subject: Re: KMotionCNC/Machine Initialisation process
Hi Moray,

Regarding checking Cycle Start Conditions: I believe a Cycle Start Action to issue a Halt on invalid conditions should work.

Regarding verifying axis are homed:  You might include those conditions in the Cycle Start Action test.
 
Regarding Max Error:  assuming your normal errors during operation are always less than 50 it shouldn't make any difference whether they are set at 50 or 200.  The difference would be that errors between 50 and 200 would be responded to more aggressively when the Max error is increased.

HTH
Regards
TK

On 2/6/2016 7:48 AM, moray.cuthill@... [DynoMotion] wrote:
 

I'm mainly looking for confirmation my plan is going to work as intended, so any input to this will be welcome.


I've had my lathe running Mach3 for a couple years, and in that time I've realised the limitations of the existing setup. If my turret fails to lock, then I have to open KMotion and toggle the output to trigger another attempt at locking. The same goes for if for some reason it locks at the wrong position (Every so often it spins the wrong direction, meaning it locks in the wrong position - all that is handled by a PLC, and I've never been able to figure out why, but at most it happens once every couple of hundred changes, and the PLC flags it up as a problem and motion stops so is pretty low on the list of priorities).


As part of my move from Mach3, I'm cleaning up and re-writing code as I go.


My current init flow is something along the lines of-

1) Initialise axis servos. Disable and trigger reset line if needed. If one attempt fails, display message box and ask if another attempt should be made. If not, sit in an infinite loop to stop anything happening. Init has to be run again if needed.

At this point jogging/homing can be allowed, but no code ran.


2) Check status of TC. Make sure position details are being transferred via Modbus, and we have a TCOK signal from the PLC (hardwired to a Kanalog input). If any problems, display a message box, warning the TC has a problem, and advising to move the turret clear of the spindle, and use the Recover TC user button (just a small program to toggle the output allowing a change to happen, but only functions when in initialisation mode (I've got a virtual bit that gets set until everything has initialised ok).

Once the TC is showing good, the lathe can be run as normal.


One area I'm not sure about, is preventing code from being run before the machine is fully initialised. Obviously KMotionCNC doesn't have the same e-stop functionality as Mach, so I'm needing a bit clarification on how to stop things from working.

If I create a user programme that gets run when Cycle Start is pressed, which checks that everything is initialised ok (essentially checks axis are enabled, machine is homed, and TC is good), can I then use that program to issue a Halt motion command if there is a problem?

Or is there a better way to prevent code from running?


The next area is homing. Mach had LEDs showing the homed status of each axis, but I'm guessing I'll need to add checks into the KFlop to ensure homing has been completed prior to any code being executed?


One thing I've noticed when going over my Mach3 init.c file, is I obviously changed the MaxError values instead of the MaxFollowingError values for the axis (it may explain why certain crashes didn't trigger an e-stop!). They're currently 40 for the X and 50 for the Z. Will changing these back to the default of 200 have any undesired consequences, given I don't remember changing that setting when tuning the servos?


Thanks,

Moray


Group: DynoMotion Message: 12764 From: Moray Cuthill Date: 2/6/2016
Subject: Re: KMotionCNC/Machine Initialisation process
Hi Tom,

thanks for clearing that up.
I've got various virtual bits for monitoring specific things, so adding the relevant checks to a Cycle Start Action won't be a problem.

I should be good on the servo front. IIRC one axis showed only 16 steps error during setup, with the other in the 20's.

Once I get my lathe working, I'll spend some time adding a few articles to the wiki, so others can hopefully benefit from all these questions.

Thanks,
Moray



On Sun, Feb 7, 2016 at 12:11 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Moray,

Regarding checking Cycle Start Conditions: I believe a Cycle Start Action to issue a Halt on invalid conditions should work.

Regarding verifying axis are homed:  You might include those conditions in the Cycle Start Action test.
 
Regarding Max Error:  assuming your normal errors during operation are always less than 50 it shouldn't make any difference whether they are set at 50 or 200.  The difference would be that errors between 50 and 200 would be responded to more aggressively when the Max error is increased.

HTH
Regards
TK

On 2/6/2016 7:48 AM, moray.cuthill@... [DynoMotion] wrote:
 

I'm mainly looking for confirmation my plan is going to work as intended, so any input to this will be welcome.


I've had my lathe running Mach3 for a couple years, and in that time I've realised the limitations of the existing setup. If my turret fails to lock, then I have to open KMotion and toggle the output to trigger another attempt at locking. The same goes for if for some reason it locks at the wrong position (Every so often it spins the wrong direction, meaning it locks in the wrong position - all that is handled by a PLC, and I've never been able to figure out why, but at most it happens once every couple of hundred changes, and the PLC flags it up as a problem and motion stops so is pretty low on the list of priorities).


As part of my move from Mach3, I'm cleaning up and re-writing code as I go.


My current init flow is something along the lines of-

1) Initialise axis servos. Disable and trigger reset line if needed. If one attempt fails, display message box and ask if another attempt should be made. If not, sit in an infinite loop to stop anything happening. Init has to be run again if needed.

At this point jogging/homing can be allowed, but no code ran.


2) Check status of TC. Make sure position details are being transferred via Modbus, and we have a TCOK signal from the PLC (hardwired to a Kanalog input). If any problems, display a message box, warning the TC has a problem, and advising to move the turret clear of the spindle, and use the Recover TC user button (just a small program to toggle the output allowing a change to happen, but only functions when in initialisation mode (I've got a virtual bit that gets set until everything has initialised ok).

Once the TC is showing good, the lathe can be run as normal.


One area I'm not sure about, is preventing code from being run before the machine is fully initialised. Obviously KMotionCNC doesn't have the same e-stop functionality as Mach, so I'm needing a bit clarification on how to stop things from working.

If I create a user programme that gets run when Cycle Start is pressed, which checks that everything is initialised ok (essentially checks axis are enabled, machine is homed, and TC is good), can I then use that program to issue a Halt motion command if there is a problem?

Or is there a better way to prevent code from running?


The next area is homing. Mach had LEDs showing the homed status of each axis, but I'm guessing I'll need to add checks into the KFlop to ensure homing has been completed prior to any code being executed?


One thing I've noticed when going over my Mach3 init.c file, is I obviously changed the MaxError values instead of the MaxFollowingError values for the axis (it may explain why certain crashes didn't trigger an e-stop!). They're currently 40 for the X and 50 for the Z. Will changing these back to the default of 200 have any undesired consequences, given I don't remember changing that setting when tuning the servos?


Thanks,

Moray